/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1618750396179_7837';

  // add your middleware config here
  config.middleware = [ 'multer', 'params' ];

  config.security = {
    enable: false,
    csrf: {
      enable: false,
    },
  };

  config.multer = {
    single: 'file', // 单文件模式
    // array: 'files', // 多文件模式
  };

  config.mongoose = {
    client: {
      url: 'mongodb://test-dev:123456@47.93.202.11:27017/daka?authSource=admin',
      options: {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useFindAndModify: false,
        useCreateIndex: true,
      },
    },
  };

  config.jwt = {
    debug: true, // 返回具体的错误信息，生产环境建议关掉
    key: 'payload',
    secret: '5ADv7idshGsY14b2',
    unless: [{ path: '/login', method: 'POST' }],
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
